Attribute VB_Name = "TextFile"

Function ReadFile(strFileName As String, Optional charset As String = "UTF-8") As String
    With CreateObject("ADODB.Stream")
        .Type = 2    'adTypeText
        .Mode = 3
        .Open
        .LoadFromFile strFileName
        .charset = charset
        .Position = 2
        ReadFile = .ReadText
        .Close
    End With
End Function

Function WriteFile(strFileName As String, strFileText As String, Optional charset As String = "UTF-8") As Boolean
    On Error GoTo ErrorHandler
     Dim objStream As Object
    Set objStream = CreateObject("ADODB.Stream")
    With objStream
        .Type = 2               'adTypeText
        .charset = charset
        .Open
        .WriteText strFileText
        .SaveToFile strFileName, 2  'adSaveCreateOverWrite
    End With
    WriteFile = True
ExitEntry:
    On Error Resume Next
    Set objStream = Nothing
    Exit Function
ErrorHandler:
   WriteFile = False
   Resume ExitEntry
End Function

